package com.ttg.utils.connection;

//~--- non-JDK imports --------------------------------------------------------

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Class	ContainerShutdownHook
 * Description	
 * Create	2015.09.11 at 01:24:31 CST
 * @author	Ardy    
 */
public class ContainerShutdownHook extends Thread {

    /** 
     * Field logger
     * Description 
     */
    private final Log logger = LogFactory.getLog(ContainerShutdownHook.class);

    /** 
     * Field httpClient
     * Description 
     */
    private final HttpClient httpClient;

    /**
     * Constructs	ContainerShutdownHook
     * Description
     *
     * @param httpClient
     */
    public ContainerShutdownHook(HttpClient httpClient) {
        this.httpClient = httpClient;
    }

    /**
     * Method run
     * Description
     */
    public void run() {
        this.logger.warn("ContainerShutdownHook is running....");

        if (this.httpClient != null) {
            this.httpClient.close();
        }

        this.logger.warn("ContainerShutdownHook stopped....");
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
